import { defHttp } from '/@/utils/http/axios';
import { InfoParams, RecInfoListGetResultModel } from './infoModel';

enum Api {
  List = '/recommend/pageRecommendInfo',
  SaveOrUpdate = '/recommend/saveOrUpdateRecommendInfo',
  DetailById = '/recommend/detailRecommendInfo',
  Delete = '/recommend/deleteRecommendInfo',
}

// 请求接口

export const getList = (params?: InfoParams) =>
  defHttp.get<RecInfoListGetResultModel>({ url: Api.List, params });

export const saveOrUpdate = (params?: InfoParams) =>
  defHttp.post({ url: Api.SaveOrUpdate, params}, { errorMessageMode: 'modal' });

export const detailById = (id: number) =>
  defHttp.get({ url: Api.DetailById + `/${id}` });

export const delById = (id: number) =>
  defHttp.get({ url: Api.Delete + `/${id}` });
